<template>
  <div class="demo">  
    <h2>你好我是Demo1组件！</h2> <br>
    <button @click="sensData">给demo2发送数据</button>
  </div>
</template>

<script>
  export default {
   methods:{
     sensData(){
       console.log(this.$bus);
       this.$bus.$emit('getDataFromDemo1','lyx');
     }
   }
  }
</script>

<style scoped>
    .demo{
        background-color: aquamarine;
        padding: 10px;
    }
</style>